package cn.chainco.cts.iserviceImpl;


import java.util.List;

import cn.chainco.cts.idao.ICompanyDao;
import cn.chainco.cts.iservice.ICompanyManager;
import cn.chainco.cts.jdo.Company;
import cn.chainco.cts.jdo.DataDictionary;
import cn.chainco.cts.jdo.DocTemplate;
import cn.chainco.cts.jdo.Fee;
import cn.chainco.cts.jdo.Item;
import cn.chainco.cts.jdo.Tag;
import cn.chainco.cts.jdo.User;

@SuppressWarnings("unchecked")
public class CompanyManagerImpl extends CommonManagerImpl implements ICompanyManager{
	private ICompanyDao companyDao;

	
	public ICompanyDao getCompanyDao() {
		return companyDao;
	}


	public void setCompanyDao(ICompanyDao companyDao) {
		this.companyDao = companyDao;
	}


	public Company findCompanyByPrefix(final String prefix) {
		return companyDao.findCompanyByPrefix(prefix);
	}

	public Company findCompayByUser(final User user){
	  return companyDao.findCompayByUser(user);	
	}
	
	public List<Company> findCompanyListByUser(User user){
		return companyDao.findCompanyListByUser(user);
	}
	
	/**
	 * @param likeName 是否模糊查询名字
	 * @param likePrefix  是否模糊查询前缀
	 * @param createDate  创建日期（可为空）
	 * @param toMax 大小于(日期)
	 * @param status 公司状态：null , 0申请中,1已审核,2禁用 
	 * @return
	 */
	public List<Company> findCompany(String likeName , String likePrefix , String createDate , Integer toMax , Integer status){
		return this.companyDao.findCompany(likeName, likePrefix, createDate, toMax, status);
	}
    // 标签
	public List<Tag> findTagByCompany(Company company, Integer status){
		return companyDao.findTagByCompany(company,status);
	}
	
	// 标签
	public List<Tag> findTagByCompany(Company company, String name , String status){
		return companyDao.findTagByCompany(company, name, status);
	}
	
	/**
	 * 删除公司和相关连的数据
	 * @param company
	 * @return
	 */
	public int delCompayByAll(Company company){
		return this.companyDao.delCompayByAll(company);
	}
}
